﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace EmailMarketingCampaign
{
    public partial class Login : System.Web.UI.Page
    {
        LoginControl lc = new LoginControl();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnOk_Click(object sender, EventArgs e)
        {
            string memberEmail = txtMemberEmail.Text.Trim();
            string password = txtPassword.Text.Trim();

            if (memberEmail != "" && password != "")
            {

                if (password == lc.getPassowrd(memberEmail))
                {

                    Session["memberEmail"] = memberEmail;
                    Session["memberPassword"] = password;

                    //Session["CompanyName"] = lc.getCompanyName(memberEmail);
                    Session["COMUniquelID"] = lc.getCOMUniquelID(memberEmail);
                    Session["FCKeditor:UserFilesPath"] = lc.getFilePath(memberEmail);

                    this.Response.Write(" <script>alert('Login successful.'); </script>");


                }
            }
            if ((string)Session["memberEmail"] != null)
            {
                Response.Redirect("CampaignsList.aspx");

            }
        }
    }
}
